/*
 * > /*
>  * INSANE - Interactive Structural Analysis Environment
>  *
>  * Copyright (C) 2003-2004
>  * Universidade Federal de Minas Gerais
>  * Escola de Engenharia
>  * Departamento de Engenharia de Estruturas
>  *
>  * Author's email :     insane@dees.ufmg.br
>  * Author's Website :   http://www.dees.ufmg.br/insane
>  *
>  * This program is free software; you can redistribute it and/or
>  * modify it under the terms of the GNU General Public License
>  * as published by the Free Software Foundation; either version 2
>  * of the License, or any later version.
>  *
>  * This program is distributed in the hope that it will be useful,
>  * but WITHOUT ANY WARRANTY; without even the implied warranty of
>  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>  * GNU General Public License for more details.
>  *
>  * You should have received a copy of the GNU General Public License
>  * along with this program; if not, write to the Free Software
>  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-
> 1307, USA.
 *
 */

package br.ufmg.dees.insane.ui.rich.postp.postp_view.dialog;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Locale;

import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JColorChooser;
import javax.swing.JComboBox;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

import br.ufmg.dees.insane.commons.view.ViewState;
import br.ufmg.dees.insane.ui.rich.postp.postp_view.DesktopPostp;
import br.ufmg.dees.insane.ui.rich.postp.postp_view.InterfacePostp;
import br.ufmg.dees.insane.xyplot.xyplot_view.dialog.DecimalField;

/**
 * A class representing creation dialog on screen.<br>
 * @author  Penna, Samuel & Pitangueira, Roque
 * @see xyplot_view.InterfaceXYPlot
 * @since  april 2005
 */
public final class GraphicSettingsTabbedDialog extends TabbedDialog {
	
	/**   */
	private static final long serialVersionUID = 1L;
	
	private DesktopPostp desktop;
	//private InterfacePostp parent;
	private JInternalFrame intFrame;
	//private PostpViewState state;
	//private PostpModel postpModel;
	//private StepPostp stepPostp;
	//private XYPlotViewState xyplotState;
	
    private JTextField backgroundColorField = new JTextField();
    private JTextField graphicTitleColorField = new JTextField();
    private JTextField graphicTitleField = new JTextField();
    private JTextField boundLineColorField = new JTextField();
    private JTextField gridColorField = new JTextField();
    
    private DecimalField graphicTitleSizeDecimalField;
    private DecimalField graphicTitlePositionXField;
    private DecimalField graphicTitlePositionYField;
    private DecimalField boundLineWidthDecimalField;
    private DecimalField gridwidthField;
    private DecimalField gridheightField; 
    private DecimalField gridLineWidthDecimalField;
    
    private String[] precisionStr = {"0", "0.0", "0.00", "0.000", "0.0000", "0.00000", "0.000000", "0.0000000", "0.00000000"};
    private String[] textFontStr;
    private String[] textStyle;
    private String[] markTextPlace;
    
    private JComboBox precision = new JComboBox(precisionStr);
    private JComboBox graphicTitleFontCombo;
    private JComboBox graphicTitleStyleCombo;
   
    private JButton chooseGraphicTitleColor = new JButton("Choose");
	private JButton chooseBackgroundColor = new JButton("Choose");
	private JButton chooseBoundLineColor = new JButton("Choose");
	
	
	
	//private JComboBox graphTitleFontCombo;
	//private JComboBox graphTitleFontStyleCombo;
	private JComboBox xAxisTitleFontCombo;
	private JComboBox xAxisTitleFontStyleCombo;
	private JComboBox xAxisMarksFontCombo;
	private JComboBox xAxisMarksFontStyleCombo;
	private JComboBox xAxisMarksTextPlaceCombo;
	private JComboBox yAxisTitleFontCombo;
	private JComboBox yAxisTitleFontStyleCombo;
	private JComboBox yAxisMarksFontCombo;
	private JComboBox yAxisMarksFontStyleCombo;
	private JComboBox yAxisMarksTextPlaceCombo;
	//private JComboBox xAxisValuesCombo;
	//private JComboBox yAxisValuesCombo;
	//private JComboBox precisionCombo;
	
	private JTextField xAxisTitle = new JTextField();
	private JTextField xAxisTitleColorField = new JTextField();
	private JTextField xAxisColorField = new JTextField();
	private JTextField xAxisMarksColorField = new JTextField();
    private JTextField yAxisTitle = new JTextField();
    private JTextField yAxisTitleColorField = new JTextField();
    private JTextField yAxisColorField = new JTextField();
    private JTextField yAxisMarksColorField = new JTextField();
    
	private DecimalField xAxisTitleFontSizeDecimalField;
	private DecimalField xAxisMarksFontSizeDecimalField;
	private DecimalField xAxisMarksSizeDecimalField;
	private DecimalField xAxisMainsMarksDecimalField;
	private DecimalField xAxisSecondaryMarksDecimalField;
	private DecimalField yAxisTitleFontSizeDecimalField;
	private DecimalField yAxisMarksFontSizeDecimalField;
	private DecimalField yAxisMarksSizeDecimalField;
	private DecimalField yAxisMainsMarksDecimalField;
	private DecimalField yAxisSecondaryMarksDecimalField;
	
	private JCheckBox xMarksOnCheckBox = new JCheckBox("");
	private JCheckBox xMarksOffCheckBox = new JCheckBox("");
	private JCheckBox yMarksOnCheckBox = new JCheckBox("");
	private JCheckBox yMarksOffCheckBox = new JCheckBox("");
	
	private JButton chooseXAxisTitleColorButton = new JButton("Choose");
	//private JButton chooseXAxisMarksColorButton = new JButton("Choose");
	private JButton chooseXAxisColorButton = new JButton("Choose");
	private JButton chooseYAxisTitleColorButton = new JButton("Choose");
	//private JButton chooseYAxisMarksColorButton = new JButton("Choose");
	private JButton chooseYAxisColorButton = new JButton("Choose");
	
	private Color xAxisTitleColor;
	//private Color xAxisMarksFontColor;
	//private Color xAxisColor;
	private Color yAxisTitleColor;
	private Color yAxisMarksFontColor;
	private Color yAxisColor;
	
	
	private NumberFormat numberFormat;
	private double positionX;
    private double positionY;
    
    private JButton chooseGridColor = new JButton("Choose");
	
	//private java.awt.geom.Rectangle2D.Double limits = new java.awt.geom.Rectangle2D.Double();
    
    
    
	
	public GraphicSettingsTabbedDialog(InterfacePostp parent,ViewState vs){
		//super("General Settings");
		//this.parent = parent;
		//this.state = (PostpViewState)vs;
		init();
	}

	public void init(){
		 setUpFormat();
	     this.initGraphicTabb(); 
	     this.initXAxisTabb();
	     this.initYAxisTabb();
	}
	
	private void initGraphicTabb(){
//		Sets up the main panel
		 JPanel mainPane = new JPanel();
		 mainPane.setLayout(new GridLayout(2,2,2,2));          
		 mainPane.setPreferredSize(new Dimension(360,600));
		 mainPane.setMaximumSize(new Dimension(360,600));
		 mainPane.setLayout(new BoxLayout(mainPane,BoxLayout.Y_AXIS));      
	
		 //Sets fields according to state
	//	 precision.setSelectedIndex(state.getPrecision());
		 //set the precisionPane
		 JPanel precisionPane = new JPanel();
		 precisionPane.setLayout(new GridLayout(1,2,2,2));
		 precisionPane.setBorder(BorderFactory.createCompoundBorder(
				 BorderFactory.createTitledBorder("Precision"),
				 BorderFactory.createEmptyBorder(2,2,2,2)));
		 precisionPane.setMaximumSize(new Dimension(350,60));
		 precisionPane.add(new JLabel("Precision:"));
		 precisionPane.add(precision);
		 
		 //set up the graphicTitlePane
		 JPanel titlePane = new JPanel();
		 titlePane.setLayout(new GridLayout(5,2,2,2));          
		 titlePane.setPreferredSize(new Dimension(350,185));
		 titlePane.setMaximumSize(new Dimension(350,185));
		 titlePane.setBorder(BorderFactory.createCompoundBorder(
				 BorderFactory.createTitledBorder("Grafic Title"),
				 BorderFactory.createEmptyBorder(2,2,2,2)));
		 // title field 
		 titlePane.add(new JLabel("Title:"));
		 graphicTitleField.setMaximumSize(new Dimension(75,26));
		 graphicTitleField.setPreferredSize(new Dimension(75,26));
		 graphicTitleField.setMinimumSize(new Dimension(75,26));
		 graphicTitleField.setSize(new Dimension(75,26));  
	//	 graphicTitleField.setText(((XYPlotController)parent.getView().getController()).getModel().getTitle());
		 titlePane.add(graphicTitleField);
		 // title font
		 textFontStr = new String[5];
		 textFontStr[0] = "Arial";
		 textFontStr[1] = "Monospaced";
		 textFontStr[2] = "SansSerif";
		 textFontStr[3] = "Time"; 
		 textFontStr[4] = "NONE"; 
		 graphicTitleFontCombo = new JComboBox(textFontStr);
		 titlePane.add(new JLabel("Title font:"));
		 graphicTitleFontCombo.setMaximumSize(new Dimension(75,26));
		 graphicTitleFontCombo.setPreferredSize(new Dimension(75,26));
		 graphicTitleFontCombo.setMinimumSize(new Dimension(75,26));
		 graphicTitleFontCombo.setSize(new Dimension(75,26));  
		// graphicTitleFontCombo.setSelectedItem((String)state.getTitleViewState().getTitleFont());
		 titlePane.add(graphicTitleFontCombo); 
		 // title font size
		 titlePane.add(new JLabel("Size"));
		 graphicTitleSizeDecimalField = new DecimalField(10,10,numberFormat);
		 graphicTitleSizeDecimalField.setMaximumSize(new Dimension(75,26));
		 graphicTitleSizeDecimalField.setPreferredSize(new Dimension(75,26));
		 graphicTitleSizeDecimalField.setMinimumSize(new Dimension(75,26));
		 graphicTitleSizeDecimalField.setSize(new Dimension(75,26));  
		 graphicTitleSizeDecimalField.setEditable(true);
		 titlePane.add(graphicTitleSizeDecimalField);
		 // title font Style
		 textStyle = new String[3];
		 textStyle[0] = "Plain";
		 textStyle[1] = "Bold";
		 textStyle[2] = "Italic";
		 graphicTitleStyleCombo = new JComboBox(textStyle);
		 titlePane.add(new JLabel("Font Style:"));
		 graphicTitleStyleCombo.setMaximumSize(new Dimension(75,26));
		 graphicTitleStyleCombo.setPreferredSize(new Dimension(75,26));
		 graphicTitleStyleCombo.setMinimumSize(new Dimension(75,26));
		 graphicTitleStyleCombo.setSize(new Dimension(75,26));  
	//	 graphicTitleStyleCombo.setSelectedIndex(state.getTitleViewState().getTitleStyle());
		 titlePane.add(graphicTitleStyleCombo); 
		 // title position X  
		 JPanel positionXPanel = new JPanel();
		 positionXPanel.setLayout(new GridLayout(1,2,2,2));  
		 positionXPanel.setMaximumSize(new Dimension(75,26));
		 positionXPanel.setPreferredSize(new Dimension(75,26));
		 positionXPanel.setMinimumSize(new Dimension(75,26));
		 positionXPanel.setSize(new Dimension(75,26));  
		 positionXPanel.add(new JLabel("Position X"));
		 graphicTitlePositionXField = new DecimalField(positionX,10,numberFormat);
		 graphicTitlePositionXField.setMaximumSize(new Dimension(75,26));
		 graphicTitlePositionXField.setPreferredSize(new Dimension(75,26));
		 graphicTitlePositionXField.setMinimumSize(new Dimension(75,26));
		 graphicTitlePositionXField.setSize(new Dimension(75,26));  
	//	 graphicTitlePositionXField.setValue(state.getTitleViewState().getXCenterPosition());
		 positionXPanel.add(graphicTitlePositionXField);
		 titlePane.add(positionXPanel);
		 // title position Y
		 JPanel positionYPanel = new JPanel();
		 positionYPanel.setLayout(new GridLayout(1,2,2,2));  
		 positionYPanel.setMaximumSize(new Dimension(75,26));
		 positionYPanel.setPreferredSize(new Dimension(75,26));
		 positionYPanel.setMinimumSize(new Dimension(75,26));
		 positionYPanel.setSize(new Dimension(75,26));  
		 positionYPanel.add(new JLabel("Position Y"));
		 graphicTitlePositionYField = new DecimalField(positionY,10,numberFormat);
		 graphicTitlePositionYField.setMaximumSize(new Dimension(75,26));
		 graphicTitlePositionYField.setPreferredSize(new Dimension(75,26));
		 graphicTitlePositionYField.setMinimumSize(new Dimension(75,26));
	//	 graphicTitlePositionYField.setValue(state.getTitleViewState().getYCenterPosition());
		 positionYPanel.add(graphicTitlePositionYField);
		 titlePane.add(positionYPanel);
	    
		 //Setting subpanel colors Title panel 
		 JPanel graphicTitleColorsPane = new JPanel();
		 graphicTitleColorsPane.setLayout(new BoxLayout(graphicTitleColorsPane, BoxLayout.Y_AXIS));
		 graphicTitleColorsPane.setMaximumSize(new Dimension(350,45));
		 graphicTitleColorsPane.setBorder(BorderFactory.createCompoundBorder(
				 BorderFactory.createTitledBorder("Title Color"),
				 BorderFactory.createEmptyBorder(2,2,2,2)));
		 graphicTitleColorsPane.setLayout(new GridLayout(1,3,3,3));
		 graphicTitleColorsPane.add(new JLabel("Title Color"));
		 graphicTitleColorField = new JTextField();
		 graphicTitleColorField.setEditable(false);
	//	 graphicTitleColorField.setBackground(state.getTitleViewState().getColor());
		 graphicTitleColorsPane.add(graphicTitleColorField);
		 chooseGraphicTitleColor = new JButton("Choose");
		 graphicTitleColorsPane.add(chooseGraphicTitleColor);
		 chooseGraphicTitleColor.addActionListener(new ActionListener() {
			 public void actionPerformed(ActionEvent e) {
				 titleColorActionPerformed(e);
			 }
		 } );
	     
		 //Sets the background colors panel
		 JPanel backgroundColorsPane = new JPanel();
		 backgroundColorsPane.setLayout(new BoxLayout(graphicTitleColorsPane, BoxLayout.Y_AXIS));
		 backgroundColorsPane.setMaximumSize(new Dimension(350,45));
		 backgroundColorsPane.setBorder(BorderFactory.createCompoundBorder(
				 BorderFactory.createTitledBorder("Background"),
				 BorderFactory.createEmptyBorder(2,2,2,2)));
		 backgroundColorsPane.setLayout(new GridLayout(1,3,3,3));
		 backgroundColorsPane.add(new JLabel("Background Color"));
		 backgroundColorField = new JTextField();
		 backgroundColorField.setEditable(false);
		 backgroundColorField.setBackground( Color.BLACK);
		 backgroundColorsPane.add(backgroundColorField);
		 chooseBackgroundColor = new JButton("Choose");
		 backgroundColorsPane.add(chooseBackgroundColor);
		 chooseBackgroundColor.addActionListener(new ActionListener() {
			 public void actionPerformed(ActionEvent e) {
				 backColorActionPerformed(e);
			 }
		 } );
	        
	     
		 //set the boundaryPane
		 JPanel boundaryPane = new JPanel();
		 boundaryPane.setLayout(new GridLayout(1,2,2,2));          
		 boundaryPane.setMaximumSize(new Dimension(350,85));
		 boundaryPane.setBorder(BorderFactory.createCompoundBorder(
				 BorderFactory.createTitledBorder("Boundary"),
				 BorderFactory.createEmptyBorder(2,2,2,2)));
		 // line width
		 boundaryPane.add(new JLabel("Line Width:"));
		 boundLineWidthDecimalField = new DecimalField(1,10,numberFormat);
		 boundLineWidthDecimalField.setMaximumSize(new Dimension(75,25));
		 boundLineWidthDecimalField.setPreferredSize(new Dimension(75,25));
		 boundLineWidthDecimalField.setMinimumSize(new Dimension(75,25));
		 boundLineWidthDecimalField.setSize(new Dimension(75,25));  
		 boundLineWidthDecimalField.setEditable(true);
	//	 boundLineWidthDecimalField.setValue(state.boundaryLineWidth);
		 boundaryPane.add(boundLineWidthDecimalField);
		 //Setting subpanel colors line panel 
		 JPanel boundLineColorPane = new JPanel();
		 boundLineColorPane.setLayout(new BoxLayout(boundLineColorPane, BoxLayout.Y_AXIS));
		 boundLineColorPane.setMaximumSize(new Dimension(350,60));
		 boundLineColorPane.setBorder(BorderFactory.createCompoundBorder(
				 BorderFactory.createTitledBorder(""),
				 BorderFactory.createEmptyBorder(2,2,2,2)));
		 boundLineColorPane.setLayout(new GridLayout(1,3,3,3));
		 boundLineColorPane.add(new JLabel("Line Color:"));
		 boundLineColorField = new JTextField();
		 boundLineColorField.setEditable(false);
		 boundLineColorField.setBackground(Color.BLACK );
		 boundLineColorPane.add(boundLineColorField);
		 chooseBoundLineColor = new JButton("Choose");
		 boundLineColorPane.add(chooseBoundLineColor);
		 chooseBoundLineColor.addActionListener(new ActionListener() {
			 public void actionPerformed(ActionEvent e) {
				 boundlineColorActionPerformed(e);
			 }
		 } );      
	     
		 //Sets fields according to model
	     JPanel gridPane = new JPanel();
	     gridPane.setLayout(new GridLayout(2,4,2,2));   
	     gridPane.setMaximumSize(new Dimension(350,300));
	     gridPane.setBorder(BorderFactory.createCompoundBorder(
	    		 BorderFactory.createTitledBorder("Grid settings"),
	    		 BorderFactory.createEmptyBorder(2,2,2,2)));
	     gridPane.add(new JLabel(" Width Space:"));
	     gridwidthField  = new DecimalField(1, 10, numberFormat);
	     gridPane.add(gridwidthField);
	     
	     gridPane.add(new JLabel(" Heigt Space:"));
	     gridheightField  = new DecimalField(1, 10, numberFormat);
	     gridPane.add(gridheightField);
	     
	     gridPane.add(new JLabel("Line Width:"));
	     gridLineWidthDecimalField = new DecimalField(1,10,numberFormat);
	     gridLineWidthDecimalField.setMaximumSize(new Dimension(75,25));
	     gridLineWidthDecimalField.setPreferredSize(new Dimension(75,25));
	     gridLineWidthDecimalField.setMinimumSize(new Dimension(75,25));
	     gridLineWidthDecimalField.setSize(new Dimension(75,25));  
	     gridLineWidthDecimalField.setEditable(true);
	     gridPane.add(gridLineWidthDecimalField);
	     gridPane.add(new JLabel("  "));
	     gridPane.add(new JLabel("  "));
	     
//	   Sets the background colors panel
		 JPanel gridColorsPane = new JPanel();
		 gridColorsPane.setLayout(new BoxLayout(graphicTitleColorsPane, BoxLayout.Y_AXIS));
		 gridColorsPane.setMaximumSize(new Dimension(350,45));
		 gridColorsPane.setBorder(BorderFactory.createCompoundBorder(
				 BorderFactory.createTitledBorder("Grid Color"),
				 BorderFactory.createEmptyBorder(2,2,2,2)));
		 gridColorsPane.setLayout(new GridLayout(1,3,3,3));
		 gridColorsPane.add(new JLabel("Set Color"));
		 gridColorField = new JTextField();
		 gridColorField.setEditable(false);
		 gridColorField.setBackground( Color.BLACK);
		 gridColorsPane.add(gridColorField);
		 chooseGridColor = new JButton("Choose");
		 gridColorsPane.add(chooseGridColor);
		 chooseGridColor.addActionListener(new ActionListener() {
	    	 public void actionPerformed(ActionEvent e) {
	//    		 gridColorActionPerformed(e);
	    	 }
	     } );
	     
	     
		 mainPane.add(precisionPane);
		 mainPane.add(titlePane);
		 mainPane.add(graphicTitleColorsPane);
		 mainPane.add(backgroundColorsPane);
		 mainPane.add(boundaryPane);
		 mainPane.add(boundLineColorPane);
		 mainPane.add(gridPane);
		 mainPane.add(gridColorsPane);
		 this.addTab("Graphic Settings",mainPane);
		
	}

	private void initXAxisTabb(){
		/**
		 *  set the xAxis 
		**/        
//		Sets up the main panel
		 JPanel xAxisPane = new JPanel();
		 xAxisPane.setLayout(new GridLayout(2,2,2,2));          
		 xAxisPane.setPreferredSize(new Dimension(360,600));
		 xAxisPane.setMaximumSize(new Dimension(360,600));
		 xAxisPane.setLayout(new BoxLayout(xAxisPane,BoxLayout.Y_AXIS)); 
		
		 JPanel xAxisTitlePane = new JPanel();
		 xAxisTitlePane.setLayout(new GridLayout(4,2,2,2));          
		 xAxisTitlePane.setMaximumSize(new Dimension(350,150));
		 xAxisTitlePane.setBorder(BorderFactory.createCompoundBorder(
				 BorderFactory.createTitledBorder("Title Settings"),
				 BorderFactory.createEmptyBorder(2,2,2,2)));
	   
		 //set the title
		 xAxisTitlePane.add(new JLabel("Title"));
		 xAxisTitle = new JTextField();
		 xAxisTitle.setMaximumSize(new Dimension(75,25));
		 xAxisTitle.setPreferredSize(new Dimension(75,25));
		 xAxisTitle.setMinimumSize(new Dimension(75,25));
		 xAxisTitle.setSize(new Dimension(75,25));  
		 xAxisTitle.setEditable(true);
		 xAxisTitlePane.add(xAxisTitle);
	
		 //set the title font
		 textFontStr = new String[5];
		 textFontStr[0] = "Arial";
		 textFontStr[1] = "Monospaced";
		 textFontStr[2] = "SansSerif";
		 textFontStr[3] = "Time"; 
		 textFontStr[4] = "NONE"; 
		 xAxisTitleFontCombo = new JComboBox(textFontStr);
		 xAxisTitlePane.add(new JLabel("Title font:"));
		 xAxisTitleFontCombo.setMaximumSize(new Dimension(75,25));
		 xAxisTitleFontCombo.setPreferredSize(new Dimension(75,25));
		 xAxisTitleFontCombo.setMinimumSize(new Dimension(75,25));
		 xAxisTitleFontCombo.setSize(new Dimension(75,25));  
		 xAxisTitlePane.add(xAxisTitleFontCombo); 
		 //title font size
		 xAxisTitlePane.add(new JLabel("Font Size:"));
		 xAxisTitleFontSizeDecimalField = new DecimalField(10.0,10,numberFormat);
		 xAxisTitleFontSizeDecimalField.setMaximumSize(new Dimension(75,25));
		 xAxisTitleFontSizeDecimalField.setPreferredSize(new Dimension(75,25));
		 xAxisTitleFontSizeDecimalField.setMinimumSize(new Dimension(75,25));
		 xAxisTitleFontSizeDecimalField.setSize(new Dimension(75,25));  
		 xAxisTitleFontSizeDecimalField.setEditable(true);
		 xAxisTitlePane.add(xAxisTitleFontSizeDecimalField);
		 //title font Style
		 textStyle = new String[3];
		 textStyle[0] = "Plain";
		 textStyle[1] = "Bold";
		 textStyle[2] = "Italic";
		 xAxisTitleFontStyleCombo = new JComboBox(textStyle);
		 xAxisTitlePane.add(new JLabel("Font Style:"));
		 xAxisTitleFontStyleCombo.setMaximumSize(new Dimension(75,25));
		 xAxisTitleFontStyleCombo.setPreferredSize(new Dimension(75,25));
		 xAxisTitleFontStyleCombo.setMinimumSize(new Dimension(75,25));
		 xAxisTitleFontStyleCombo.setSize(new Dimension(75,25));  
		 xAxisTitlePane.add(xAxisTitleFontStyleCombo);
	     
		 //Sets the colors yAxis Title Color panel
		 JPanel xAxisTitleColorPane = new JPanel();
		 xAxisTitleColorPane.setLayout(new GridLayout(1,3,2,2));          
		 xAxisTitleColorPane.setMaximumSize(new Dimension(350,60));
		 xAxisTitleColorPane.setBorder(BorderFactory.createCompoundBorder(
				 BorderFactory.createTitledBorder("Title Settings"),
				 BorderFactory.createEmptyBorder(2,2,2,2)));
		 xAxisTitleColorPane.add(new JLabel("Set Color"));
		 xAxisTitleColorField = new JTextField();
		 xAxisTitleColorField.setEditable(false);
		 xAxisTitleColorField.setBackground(xAxisTitleColor);
		 xAxisTitleColorPane.add(xAxisTitleColorField);
		 chooseXAxisTitleColorButton = new JButton("Choose");
		 xAxisTitleColorPane.add(chooseXAxisTitleColorButton);
		 chooseXAxisTitleColorButton.addActionListener(new ActionListener() {
			 public void actionPerformed(ActionEvent e) {
				 xAxisTitleColorActionPerformed(e);
			 }
		 } );
		 
		 //Sets the marks On/Off xAxis panel
		 JPanel xAxisMarksPane = new JPanel();
		 xAxisMarksPane.setLayout(new GridLayout(8,2,2,2));          
		 xAxisMarksPane.setMaximumSize(new Dimension(350,275));
		 xAxisMarksPane.setBorder(BorderFactory.createCompoundBorder(
	        		BorderFactory.createTitledBorder("Marks Settings"),
	        		BorderFactory.createEmptyBorder(2,2,2,2)));
	   
		 ActionListener xAxisMarksListenerOn = new ChoiceListenerXAxisMarksOn();         
		 xMarksOnCheckBox.setText("Marks On");
		 xMarksOnCheckBox.addActionListener(xAxisMarksListenerOn);
		 xAxisMarksPane.add(xMarksOnCheckBox); 
		 //ActionListener xAxisMarksListenerOff = new ChoiceListenerXAxisMarksOff();  
		 xMarksOffCheckBox.setText("Marks Off");
		 xMarksOffCheckBox.addActionListener(xAxisMarksListenerOn);
		 xAxisMarksPane.add(xMarksOffCheckBox);
		 //set the marks axis font
		 textFontStr = new String[5];
		 textFontStr[0] = "Arial";
		 textFontStr[1] = "Monospaced";
		 textFontStr[2] = "SansSerif";
		 textFontStr[3] = "Time"; 
		 textFontStr[4] = "NONE"; 
		 xAxisMarksFontCombo = new JComboBox(textFontStr);
		 xAxisMarksPane.add(new JLabel("Title font:"));
		 xAxisMarksFontCombo.setMaximumSize(new Dimension(75,25));
		 xAxisMarksFontCombo.setPreferredSize(new Dimension(75,25));
		 xAxisMarksFontCombo.setMinimumSize(new Dimension(75,25));
		 xAxisMarksFontCombo.setSize(new Dimension(75,25));  
		 xAxisMarksPane.add(xAxisMarksFontCombo); 
		 //marks font size
		 xAxisMarksPane.add(new JLabel("Font Size:"));
		 xAxisMarksFontSizeDecimalField = new DecimalField(10.0,10,numberFormat);
		 xAxisMarksFontSizeDecimalField.setMaximumSize(new Dimension(75,25));
		 xAxisMarksFontSizeDecimalField.setPreferredSize(new Dimension(75,25));
		 xAxisMarksFontSizeDecimalField.setMinimumSize(new Dimension(75,25));
		 xAxisMarksFontSizeDecimalField.setSize(new Dimension(75,25));  
		 xAxisMarksFontSizeDecimalField.setEditable(true);
		 xAxisMarksPane.add(xAxisMarksFontSizeDecimalField);
		 //title font Style
		 textStyle = new String[3];
		 textStyle[0] = "Plain";
		 textStyle[1] = "Bold";
		 textStyle[2] = "Italic";
		 xAxisMarksFontStyleCombo = new JComboBox(textStyle);
		 xAxisMarksPane.add(new JLabel("Font Style:"));
		 xAxisMarksFontStyleCombo.setMaximumSize(new Dimension(75,25));
		 xAxisMarksFontStyleCombo.setPreferredSize(new Dimension(75,25));
		 xAxisMarksFontStyleCombo.setMinimumSize(new Dimension(75,25));
		 xAxisMarksFontStyleCombo.setSize(new Dimension(75,25));  
		 xAxisMarksPane.add(xAxisMarksFontStyleCombo);
		 //marks text Place
		 markTextPlace = new String[4];
		 markTextPlace[0] = "NORTH";
		 markTextPlace[1] = "SOUTH";
		 markTextPlace[2] = "EAST";
		 markTextPlace[3] = "WEST";
		 xAxisMarksTextPlaceCombo = new JComboBox(markTextPlace);
		 xAxisMarksPane.add(new JLabel("Place:"));
		 xAxisMarksTextPlaceCombo.setMaximumSize(new Dimension(75,25));
		 xAxisMarksTextPlaceCombo.setPreferredSize(new Dimension(75,25));
		 xAxisMarksTextPlaceCombo.setMinimumSize(new Dimension(75,25));
		 xAxisMarksTextPlaceCombo.setSize(new Dimension(75,25));  
		 xAxisMarksPane.add(xAxisMarksTextPlaceCombo);
		 //marks size
		 xAxisMarksPane.add(new JLabel("Marks Size:"));
		 xAxisMarksSizeDecimalField = new DecimalField(1,10,numberFormat);
		 xAxisMarksSizeDecimalField.setMaximumSize(new Dimension(75,25));
		 xAxisMarksSizeDecimalField.setPreferredSize(new Dimension(75,25));
		 xAxisMarksSizeDecimalField.setMinimumSize(new Dimension(75,25));
		 xAxisMarksSizeDecimalField.setSize(new Dimension(75,25));  
		 xAxisMarksSizeDecimalField.setEditable(true);
		 xAxisMarksPane.add(xAxisMarksSizeDecimalField);
		 //main marks
		 xAxisMarksPane.add(new JLabel("Main Marks:"));
		 xAxisMainsMarksDecimalField = new DecimalField(1,10,numberFormat);
		 xAxisMainsMarksDecimalField.setMaximumSize(new Dimension(75,25));
		 xAxisMainsMarksDecimalField.setPreferredSize(new Dimension(75,25));
		 xAxisMainsMarksDecimalField.setMinimumSize(new Dimension(75,25));
		 xAxisMainsMarksDecimalField.setSize(new Dimension(75,25));  
		 xAxisMainsMarksDecimalField.setEditable(true);
		 xAxisMarksPane.add(xAxisMainsMarksDecimalField);
		 //secondary marks
		 xAxisMarksPane.add(new JLabel("Secondary Marks:"));
		 xAxisSecondaryMarksDecimalField = new DecimalField(1,10,numberFormat);
		 xAxisSecondaryMarksDecimalField.setMaximumSize(new Dimension(75,25));
		 xAxisSecondaryMarksDecimalField.setPreferredSize(new Dimension(75,25));
		 xAxisSecondaryMarksDecimalField.setMinimumSize(new Dimension(75,25));
		 xAxisSecondaryMarksDecimalField.setSize(new Dimension(75,25));  
		 xAxisSecondaryMarksDecimalField.setEditable(true);
		 xAxisMarksPane.add(xAxisSecondaryMarksDecimalField);

		 //Sets the marks colors panel
		 JPanel xAxisMarksColorPane = new JPanel();
		 xAxisMarksColorPane.setLayout(new GridLayout(1,3,2,2));          
		 xAxisMarksColorPane.setMaximumSize(new Dimension(350,60));
		 xAxisMarksColorPane.setBorder(BorderFactory.createCompoundBorder(
				 BorderFactory.createTitledBorder("Marks Color"),
				 BorderFactory.createEmptyBorder(2,2,2,2)));
		 xAxisMarksColorPane.add(new JLabel("Set Color"));
		 xAxisMarksColorField = new JTextField();
		 xAxisMarksColorField.setEditable(false);
		 xAxisMarksColorField.setBackground(yAxisMarksFontColor);
		 xAxisMarksColorPane.add(yAxisMarksColorField);
		 chooseXAxisTitleColorButton = new JButton("Choose");
		 xAxisMarksColorPane.add(chooseXAxisTitleColorButton);
		 chooseXAxisTitleColorButton.addActionListener(new ActionListener() {
			 public void actionPerformed(ActionEvent e) {
				 //	 yAxisMarksColorActionPerformed(e);
			 }
		 } );

		 //Sets the axis colors panel
		 JPanel xAxisColorPane = new JPanel();
		 xAxisColorPane.setLayout(new GridLayout(1,3,2,2));          
		 xAxisColorPane.setMaximumSize(new Dimension(350,60));
		 xAxisColorPane.setBorder(BorderFactory.createCompoundBorder(
				 BorderFactory.createTitledBorder("X Aixs Color"),
				 BorderFactory.createEmptyBorder(2,2,2,2)));
		 xAxisColorPane.add(new JLabel("Set Color"));
		 xAxisColorField = new JTextField();
		 xAxisColorField.setEditable(false);
		 xAxisColorField.setBackground(yAxisColor);
		 xAxisColorPane.add(xAxisColorField);
		 chooseYAxisColorButton = new JButton("Choose");
		 xAxisColorPane.add(chooseXAxisColorButton);
		 chooseYAxisColorButton.addActionListener(new ActionListener() {
			 public void actionPerformed(ActionEvent e) {
				 //	 yAxisMarksColorActionPerformed(e);
			 }
		 } );
		
		 xAxisPane.add(xAxisTitlePane);
		 xAxisPane.add(xAxisTitleColorPane);
		 xAxisPane.add(new JLabel(" "));
		 xAxisPane.add(xAxisMarksPane);
		 xAxisPane.add(xAxisMarksColorPane);
		 xAxisPane.add(xAxisColorPane);
	        
		 this.addTab("X Axis",xAxisPane);
	
	}

	private void initYAxisTabb(){
		/**
		 *  set the yAxis 
		**/        
//		Sets up the main panel
		 JPanel yAxisPane = new JPanel();
		 yAxisPane.setLayout(new GridLayout(2,2,2,2));          
		 yAxisPane.setPreferredSize(new Dimension(360,600));
		 yAxisPane.setMaximumSize(new Dimension(360,600));
		 yAxisPane.setLayout(new BoxLayout(yAxisPane,BoxLayout.Y_AXIS)); 
		
		 JPanel yAxisTitlePane = new JPanel();
		 yAxisTitlePane.setLayout(new GridLayout(4,2,2,2));          
		 yAxisTitlePane.setMaximumSize(new Dimension(350,150));
		 yAxisTitlePane.setBorder(BorderFactory.createCompoundBorder(
				 BorderFactory.createTitledBorder("Title Settings"),
				 BorderFactory.createEmptyBorder(2,2,2,2)));
	   
		 //set the title
		 yAxisTitlePane.add(new JLabel("Title"));
		 yAxisTitle = new JTextField();
		 yAxisTitle.setMaximumSize(new Dimension(75,25));
		 yAxisTitle.setPreferredSize(new Dimension(75,25));
		 yAxisTitle.setMinimumSize(new Dimension(75,25));
		 yAxisTitle.setSize(new Dimension(75,25));  
		 yAxisTitle.setEditable(true);
		 yAxisTitlePane.add(yAxisTitle);
	
		 //set the title font
		 textFontStr = new String[5];
		 textFontStr[0] = "Arial";
		 textFontStr[1] = "Monospaced";
		 textFontStr[2] = "SansSerif";
		 textFontStr[3] = "Time"; 
		 textFontStr[4] = "NONE"; 
		 yAxisTitleFontCombo = new JComboBox(textFontStr);
		 yAxisTitlePane.add(new JLabel("Title font:"));
		 yAxisTitleFontCombo.setMaximumSize(new Dimension(75,25));
		 yAxisTitleFontCombo.setPreferredSize(new Dimension(75,25));
		 yAxisTitleFontCombo.setMinimumSize(new Dimension(75,25));
		 yAxisTitleFontCombo.setSize(new Dimension(75,25));  
		 yAxisTitlePane.add(yAxisTitleFontCombo); 
		 //title font size
		 yAxisTitlePane.add(new JLabel("Font Size:"));
		 yAxisTitleFontSizeDecimalField = new DecimalField(10.0,10,numberFormat);
		 yAxisTitleFontSizeDecimalField.setMaximumSize(new Dimension(75,25));
		 yAxisTitleFontSizeDecimalField.setPreferredSize(new Dimension(75,25));
		 yAxisTitleFontSizeDecimalField.setMinimumSize(new Dimension(75,25));
		 yAxisTitleFontSizeDecimalField.setSize(new Dimension(75,25));  
		 yAxisTitleFontSizeDecimalField.setEditable(true);
		 yAxisTitlePane.add(yAxisTitleFontSizeDecimalField);
		 //title font Style
		 textStyle = new String[3];
		 textStyle[0] = "Plain";
		 textStyle[1] = "Bold";
		 textStyle[2] = "Italic";
		 yAxisTitleFontStyleCombo = new JComboBox(textStyle);
		 yAxisTitlePane.add(new JLabel("Font Style:"));
		 yAxisTitleFontStyleCombo.setMaximumSize(new Dimension(75,25));
		 yAxisTitleFontStyleCombo.setPreferredSize(new Dimension(75,25));
		 yAxisTitleFontStyleCombo.setMinimumSize(new Dimension(75,25));
		 yAxisTitleFontStyleCombo.setSize(new Dimension(75,25));  
		 yAxisTitlePane.add(yAxisTitleFontStyleCombo);
	     
		 //Sets the colors yAxis Title Color panel
		 JPanel yAxisTitleColorPane = new JPanel();
		 yAxisTitleColorPane.setLayout(new GridLayout(1,3,2,2));          
		 yAxisTitleColorPane.setMaximumSize(new Dimension(350,60));
		 yAxisTitleColorPane.setBorder(BorderFactory.createCompoundBorder(
				 BorderFactory.createTitledBorder("Title Settings"),
				 BorderFactory.createEmptyBorder(2,2,2,2)));
		 yAxisTitleColorPane.add(new JLabel("Set Color"));
		 yAxisTitleColorField = new JTextField();
		 yAxisTitleColorField.setEditable(false);
		 yAxisTitleColorField.setBackground(yAxisTitleColor);
		 yAxisTitleColorPane.add(yAxisTitleColorField);
		 chooseYAxisTitleColorButton = new JButton("Choose");
		 yAxisTitleColorPane.add(chooseYAxisTitleColorButton);
		 chooseYAxisTitleColorButton.addActionListener(new ActionListener() {
			 public void actionPerformed(ActionEvent e) {
				 yAxisTitleColorActionPerformed(e);
			 }
		 } );
		 
		 //Sets the marks On/Off xAxis panel
		 JPanel yAxisMarksPane = new JPanel();
		 yAxisMarksPane.setLayout(new GridLayout(8,2,2,2));          
		 yAxisMarksPane.setMaximumSize(new Dimension(350,275));
		 yAxisMarksPane.setBorder(BorderFactory.createCompoundBorder(
	        		BorderFactory.createTitledBorder("Marks Settings"),
	        		BorderFactory.createEmptyBorder(2,2,2,2)));
	   
		 ActionListener yAxisMarksListenerOn = new ChoiceListenerYAxisMarksOn();         
		 yMarksOnCheckBox.setText("Marks On");
		 yMarksOnCheckBox.addActionListener(yAxisMarksListenerOn);
		 yAxisMarksPane.add(yMarksOnCheckBox); 
		 //ActionListener yAxisMarksListenerOff = new ChoiceListenerYAxisMarksOff();  
		 yMarksOffCheckBox.setText("Marks Off");
		 yMarksOffCheckBox.addActionListener(yAxisMarksListenerOn);
		 yAxisMarksPane.add(yMarksOffCheckBox);
		 //set the marks axis font
		 textFontStr = new String[5];
		 textFontStr[0] = "Arial";
		 textFontStr[1] = "Monospaced";
		 textFontStr[2] = "SansSerif";
		 textFontStr[3] = "Time"; 
		 textFontStr[4] = "NONE"; 
		 yAxisMarksFontCombo = new JComboBox(textFontStr);
		 yAxisMarksPane.add(new JLabel("Title font:"));
		 yAxisMarksFontCombo.setMaximumSize(new Dimension(75,25));
		 yAxisMarksFontCombo.setPreferredSize(new Dimension(75,25));
		 yAxisMarksFontCombo.setMinimumSize(new Dimension(75,25));
		 yAxisMarksFontCombo.setSize(new Dimension(75,25));  
		 yAxisMarksPane.add(yAxisMarksFontCombo); 
		 //marks font size
		 yAxisMarksPane.add(new JLabel("Font Size:"));
		 yAxisMarksFontSizeDecimalField = new DecimalField(10.0,10,numberFormat);
		 yAxisMarksFontSizeDecimalField.setMaximumSize(new Dimension(75,25));
		 yAxisMarksFontSizeDecimalField.setPreferredSize(new Dimension(75,25));
		 yAxisMarksFontSizeDecimalField.setMinimumSize(new Dimension(75,25));
		 yAxisMarksFontSizeDecimalField.setSize(new Dimension(75,25));  
		 yAxisMarksFontSizeDecimalField.setEditable(true);
		 yAxisMarksPane.add(yAxisMarksFontSizeDecimalField);
		 //title font Style
		 textStyle = new String[3];
		 textStyle[0] = "Plain";
		 textStyle[1] = "Bold";
		 textStyle[2] = "Italic";
		 yAxisMarksFontStyleCombo = new JComboBox(textStyle);
		 yAxisMarksPane.add(new JLabel("Font Style:"));
		 yAxisMarksFontStyleCombo.setMaximumSize(new Dimension(75,25));
		 yAxisMarksFontStyleCombo.setPreferredSize(new Dimension(75,25));
		 yAxisMarksFontStyleCombo.setMinimumSize(new Dimension(75,25));
		 yAxisMarksFontStyleCombo.setSize(new Dimension(75,25));  
		 yAxisMarksPane.add(yAxisMarksFontStyleCombo);
		 //marks text Place
		 markTextPlace = new String[4];
		 markTextPlace[0] = "NORTH";
		 markTextPlace[1] = "SOUTH";
		 markTextPlace[2] = "EAST";
		 markTextPlace[3] = "WEST";
		 yAxisMarksTextPlaceCombo = new JComboBox(markTextPlace);
		 yAxisMarksPane.add(new JLabel("Place:"));
		 yAxisMarksTextPlaceCombo.setMaximumSize(new Dimension(75,25));
		 yAxisMarksTextPlaceCombo.setPreferredSize(new Dimension(75,25));
		 yAxisMarksTextPlaceCombo.setMinimumSize(new Dimension(75,25));
		 yAxisMarksTextPlaceCombo.setSize(new Dimension(75,25));  
		 yAxisMarksPane.add(yAxisMarksTextPlaceCombo);
		 //marks size
		 yAxisMarksPane.add(new JLabel("Marks Size:"));
		 yAxisMarksSizeDecimalField = new DecimalField(1,10,numberFormat);
		 yAxisMarksSizeDecimalField.setMaximumSize(new Dimension(75,25));
		 yAxisMarksSizeDecimalField.setPreferredSize(new Dimension(75,25));
		 yAxisMarksSizeDecimalField.setMinimumSize(new Dimension(75,25));
		 yAxisMarksSizeDecimalField.setSize(new Dimension(75,25));  
		 yAxisMarksSizeDecimalField.setEditable(true);
		 yAxisMarksPane.add(yAxisMarksSizeDecimalField);
		 //main marks
		 yAxisMarksPane.add(new JLabel("Main Marks:"));
		 yAxisMainsMarksDecimalField = new DecimalField(1,10,numberFormat);
		 yAxisMainsMarksDecimalField.setMaximumSize(new Dimension(75,25));
		 yAxisMainsMarksDecimalField.setPreferredSize(new Dimension(75,25));
		 yAxisMainsMarksDecimalField.setMinimumSize(new Dimension(75,25));
		 yAxisMainsMarksDecimalField.setSize(new Dimension(75,25));  
		 yAxisMainsMarksDecimalField.setEditable(true);
		 yAxisMarksPane.add(yAxisMainsMarksDecimalField);
		 //secondary marks
		 yAxisMarksPane.add(new JLabel("Secondary Marks:"));
		 yAxisSecondaryMarksDecimalField = new DecimalField(1,10,numberFormat);
		 yAxisSecondaryMarksDecimalField.setMaximumSize(new Dimension(75,25));
		 yAxisSecondaryMarksDecimalField.setPreferredSize(new Dimension(75,25));
		 yAxisSecondaryMarksDecimalField.setMinimumSize(new Dimension(75,25));
		 yAxisSecondaryMarksDecimalField.setSize(new Dimension(75,25));  
		 yAxisSecondaryMarksDecimalField.setEditable(true);
		 yAxisMarksPane.add(yAxisSecondaryMarksDecimalField);

		 //Sets the marks colors panel
		 JPanel yAxisMarksColorPane = new JPanel();
		 yAxisMarksColorPane.setLayout(new GridLayout(1,3,2,2));          
		 yAxisMarksColorPane.setMaximumSize(new Dimension(350,60));
		 yAxisMarksColorPane.setBorder(BorderFactory.createCompoundBorder(
				 BorderFactory.createTitledBorder("Marks Color"),
				 BorderFactory.createEmptyBorder(2,2,2,2)));
		 yAxisMarksColorPane.add(new JLabel("Set Color"));
		 yAxisMarksColorField = new JTextField();
		 yAxisMarksColorField.setEditable(false);
		 yAxisMarksColorField.setBackground(yAxisMarksFontColor);
		 yAxisMarksColorPane.add(yAxisMarksColorField);
		 chooseYAxisTitleColorButton = new JButton("Choose");
		 yAxisMarksColorPane.add(chooseYAxisTitleColorButton);
		 chooseYAxisTitleColorButton.addActionListener(new ActionListener() {
			 public void actionPerformed(ActionEvent e) {
				 //	 yAxisMarksColorActionPerformed(e);
			 }
		 } );

		 //Sets the axis colors panel
		 JPanel yAxisColorPane = new JPanel();
		 yAxisColorPane.setLayout(new GridLayout(1,3,2,2));          
		 yAxisColorPane.setMaximumSize(new Dimension(350,60));
		 yAxisColorPane.setBorder(BorderFactory.createCompoundBorder(
				 BorderFactory.createTitledBorder("Y Aixs Color"),
				 BorderFactory.createEmptyBorder(2,2,2,2)));
		 yAxisColorPane.add(new JLabel("Set Color"));
		 yAxisColorField = new JTextField();
		 yAxisColorField.setEditable(false);
		 yAxisColorField.setBackground(yAxisColor);
		 yAxisColorPane.add(yAxisColorField);
		 chooseYAxisColorButton = new JButton("Choose");
		 yAxisColorPane.add(chooseYAxisColorButton);
		 chooseYAxisColorButton.addActionListener(new ActionListener() {
			 public void actionPerformed(ActionEvent e) {
				 //	 yAxisMarksColorActionPerformed(e);
			 }
		 } );
		
		 yAxisPane.add(yAxisTitlePane);
		 yAxisPane.add(yAxisTitleColorPane);
		 yAxisPane.add(new JLabel(" "));
		 yAxisPane.add(yAxisMarksPane);
		 yAxisPane.add(yAxisMarksColorPane);
		 yAxisPane.add(yAxisColorPane);
	        
		 this.addTab("Y Axis",yAxisPane);

	}
		
	/**
     * This method is executed on OK button click.
     *
     */
    public void approvedPerform() {
        try {
			/*state.setPrecision(precision.getSelectedIndex());
			((XYPlotController)parent.getView().getController()).getModel().setTitle((String)this.graphicTitleField.getText());
			state.getTitleViewState().setTitleFont((String)this.graphicTitleFontCombo.getSelectedItem());
			state.getTitleViewState().setTitleSize((int)this.graphicTitleSizeDecimalField.getValue());
			state.getTitleViewState().setTitleStyle((byte)this.graphicTitleStyleCombo.getSelectedIndex());
			state.getTitleViewState().setXCenterPosition((double)this.graphicTitlePositionXField.getValue());
			state.getTitleViewState().setYCenterPosition((double)this.graphicTitlePositionYField.getValue());
			state.getTitleViewState().setColor(this.graphicTitleColorField.getBackground());
			state.bgcolor = backgroundColorField.getBackground();
            state.boundaryLineWidth = this.boundLineWidthDecimalField.getValue();
            state.boundaryColor = this.boundLineColorField.getBackground();
			//parent.setModel(parent.getModel());
            this.setVisible(false);
            ((XYPlotView)parent.getView()).getDrawingArea().repaint();
		//	LastZoomCommand cmd = new LastZoomCommand(parent);
		//	cmd.execute();
			*/
        } catch (Exception err) {
            Toolkit.getDefaultToolkit().beep();
            this.setVisible(false);
        }
    }
    
    private void titleColorActionPerformed(ActionEvent e) {
        graphicTitleColorField.setBackground(JColorChooser.showDialog(this, "Choose Title Color", graphicTitleColorField.getBackground()));
    }
    
    private void backColorActionPerformed(ActionEvent e) {
        backgroundColorField.setBackground(JColorChooser.showDialog(this, "Choose Background Color", backgroundColorField.getBackground()));
    }
    
    private void boundlineColorActionPerformed(ActionEvent e) {
       boundLineColorField.setBackground(JColorChooser.showDialog(this, "Choose Background Color", backgroundColorField.getBackground()));
    }
    
    
    private class ChoiceListenerXAxisMarksOn implements ActionListener{
        public void actionPerformed(ActionEvent event){
     	   if(xMarksOnCheckBox.isSelected()){
     		  xMarksOnCheckBox.setSelected(true);
     		 xMarksOffCheckBox.setSelected(false);
            }else{
            	xMarksOnCheckBox.setSelected(false);
            	xMarksOffCheckBox.setSelected(true);
            }
        }    
    }
    
    private void xAxisTitleColorActionPerformed(ActionEvent e) {
    	xAxisTitleColorField.setBackground(JColorChooser.showDialog(this, "Choose X Axis Title Color", xAxisTitleColorField.getBackground()));
    }
    
    private void yAxisTitleColorActionPerformed(ActionEvent e) {
    	yAxisTitleColorField.setBackground(JColorChooser.showDialog(this, "Choose Y Axis Title Color", yAxisTitleColorField.getBackground()));
    }
/*    
    private void xAxisMarkColorActionPerformed(ActionEvent e) {
    	xAxisMarksColorField.setBackground(JColorChooser.showDialog(this, "Choose X Marks Color", xAxisMarksColorField.getBackground()));
    }
	
    private void yAxisMarkColorActionPerformed(ActionEvent e) {
    	yAxisMarksColorField.setBackground(JColorChooser.showDialog(this, "Choose Y Marks Color", yAxisMarksColorField.getBackground()));
    }
    
    private void xAxisColorActionPerformed(ActionEvent e) {
    	xAxisColorField.setBackground(JColorChooser.showDialog(this, "Choose X Axis Color", xAxisColorField.getBackground()));
    }
    
    private void yAxisColorActionPerformed(ActionEvent e) {
    	yAxisColorField.setBackground(JColorChooser.showDialog(this, "Choose Y Axis Color", yAxisColorField.getBackground()));
    }
    
    private class ChoiceListenerXAxisMarksOff implements ActionListener{
        public void actionPerformed(ActionEvent event){
     	   if(xMarksOffCheckBox.isSelected()){
     		  xMarksOnCheckBox.setSelected(false);
     		 xMarksOffCheckBox.setSelected(true);
            }else{
            	xMarksOnCheckBox.setSelected(true);
            	xMarksOffCheckBox.setSelected(false);
            }
        }    
    }
*/    
    private class ChoiceListenerYAxisMarksOn implements ActionListener{
        public void actionPerformed(ActionEvent event){
     	   if(yMarksOnCheckBox.isSelected()){
     		  yMarksOnCheckBox.setSelected(true);
     		  yMarksOffCheckBox.setSelected(false);
            }else{
            	yMarksOnCheckBox.setSelected(false);
            	yMarksOffCheckBox.setSelected(true);	
            }
        }    
    }
/*    
    private class ChoiceListenerYAxisMarksOff implements ActionListener{
        public void actionPerformed(ActionEvent event){
     	   if(yMarksOffCheckBox.isSelected()){
     		  yMarksOnCheckBox.setSelected(false);
     		  yMarksOffCheckBox.setSelected(true);
            }else{
            	yMarksOnCheckBox.setSelected(true);
            	yMarksOffCheckBox.setSelected(false);
            }
        }    
    }
*/    
    /**
     * Sets the number formater
     */
    private void setUpFormat() {
        numberFormat = (DecimalFormat)NumberFormat.getNumberInstance(Locale.UK);
        numberFormat.setMaximumFractionDigits(3);
    }

	/**
	 * The method return the desktop.
	 * @return Returns The desktop.
	 */
	public DesktopPostp getDesktop() {
		return desktop;
	}

	/**
	 * The method set the field desktop from the parameter desktop.
	 * @param desktop The desktop to set.
	 */
	public void setDesktop(DesktopPostp desktop) {
		this.desktop = desktop;
	}

	/**
	 * The method return the intFrame.
	 * @return Returns The intFrame.
	 */
	public JInternalFrame getIntFrame() {
		return intFrame;
	}

	/**
	 * The method set the field intFrame from the parameter intFrame.
	 * @param intFrame The intFrame to set.
	 */
	public void setIntFrame(JInternalFrame intFrame) {
		this.intFrame = intFrame;
	}
	
//*********************************************************************************
}
